package com.ctf.soft.ms.service.manage.impl;

import com.ctf.soft.ms.dao.mapper.manage.PositionMapper;
import com.ctf.soft.ms.dao.model.manage.Position;
import com.ctf.soft.ms.service.impl.BaseService;
import com.ctf.soft.ms.service.manage.IPositionService;
import com.ctf.soft.ms.utils.ResourceUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 名称： PositionServiceImpl<br>
 * 描述： 职位业务处理实现类<br>
 * 最近修改时间：2015/7/31 13:24<br>
 * 修改说明：
 *
 * @author jiajl
 */
@Service
public class PositionServiceImpl extends BaseService<Position> implements IPositionService {

    @Autowired
    private PositionMapper positionMapper;

    public List<Position> loadPageList(Map<String, Object> map) {
        int page = Integer.valueOf(map.get("page").toString());
        int rows = Integer.valueOf(map.get("rows").toString());
        int beginRowNum = (page - 1) * rows;
        int endRowNum = page * rows;
        map.put("beginRowNum", beginRowNum);
        map.put("endRowNum", endRowNum);
        map.put("db", ResourceUtil.getString("DATA_ALIAS"));
        return positionMapper.queryForPageList(map);
    }

    public int getPageCount(Map<String, Object> map) {
        return positionMapper.queryForPageCount(map);
    }
}
